package com.dream.keigezhushou.Activity.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;


import com.dream.keigezhushou.R;

import java.util.ArrayList;

/**
 * Created by mxmf-001 on 17/2/23.
 */


public class FirstAdapter extends RecyclerView.Adapter <FirstAdapter.MyViewHolder>{
private Context context;
private ArrayList<String> Ms;

    public FirstAdapter(Context context, ArrayList<String> Ms  ){
        this.Ms=Ms;
        this.context=context;
    }
    @Override
    public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        MyViewHolder holder = new MyViewHolder(LayoutInflater.from(context).inflate(R.layout.first_item,parent,false));

        return holder;
    }

    @Override
    public void onBindViewHolder(MyViewHolder holder, int position) {
//       holder.ivtitle.setImageResource(R.drawable.golde30s);
//       holder.tvsecond.setText(Ms.get(position));
        if(position==0){
            holder.ivtitle.setImageResource(R.mipmap.a_hot);
        }
        if(position==1){
            holder.ivtitle.setImageResource(R.mipmap.a_fly);
        }
        if(position==2){
            holder.ivtitle.setImageResource(R.mipmap.a_new);
        }
//        holder.tvfirst.setText(""+1);
//        holder.tvthird.setText(""+3);
    }

    @Override
    public int getItemCount() {
        return Ms.size();
    }

    public class MyViewHolder extends RecyclerView.ViewHolder {
        ImageView ivtitle;
        TextView tvfirst;
        TextView tvsecond;
        TextView tvthird;

        public MyViewHolder(View itemView) {
            super(itemView);
            ivtitle=(ImageView)itemView.findViewById(R.id.iv_picture);
            tvfirst=(TextView)itemView.findViewById(R.id.tv_firstLine);
            tvsecond=(TextView)itemView.findViewById(R.id.tv_secondLine);
            tvthird=(TextView)itemView.findViewById(R.id.tv_thirdLine);

        }
    }



}
